<template>
  <div>
    <el-dialog :title="title" :closeOnClickModal="false" :visible.sync="show" width="650px">
      <div v-html="selectTable.content.replace(/\n/g,'<br>')"></div>
      <div slot="footer" class="dialog-footer" v-loading="pload">
        <el-button @click="show = false">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import * as api from '@/utils/api'
export default {
  components: {
  },
  props: {
    data: Object
  },
  created() {
    this.selectTable = Object.assign(this.data)
  },
  watch: {
    show(newVal) {
      this.$parent.edit = false
    }
  },
  computed: {
    title() {
      return '评论内容'
    }
  },
  data() {
    return {
      pload: false,
      rule: [
        { required: true, message: '必填项', trigger: 'change' }
      ],
      show: true,
      selectTable: {}
    }
  },
  methods: {
    async submitForm(formName) {
      await this.$refs[formName].validate()
      try {
        this.pload = true
        await api.editZBkaihu({ ...this.selectTable })
        this.$notify({ title: '操作成功', type: 'success', duration: 5000 })
        this.$parent.edit = false
        this.$emit('getData')
      } catch (e) {
        this.pload = false
      }
    }
  }
}
</script>
